package org.example.Controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import org.example.common.Result;
import org.example.pojo.Query;
import org.example.pojo.User;
import org.example.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {
    @Resource
    private UserService userService;
    @PostMapping("/login")
    public Result login(@RequestBody User user){
        Result result=userService.login(user);
        return result;

    }
    @PostMapping("/registry")
    public Result registry(@RequestBody User user){
        Result result=userService.registry(user);
        return result;

    }
    @PostMapping("/list")
    public Result list(@RequestBody Query query){
        Result result=userService.getlist(query);
        return result;

    }
    @PostMapping("/add")
    public Result add(@RequestBody User user){
        Result result=userService.add(user);
        return result;
    }
    @PostMapping("/update")
    public Result update(@RequestBody User user){
        Result result=userService.updateuser(user);
        return result;
    }
    @PostMapping("/delete")
    public Result delete(Integer id){
        Result result=userService.delete(id);
        return result;
    }
}
